全部文档

5.3OPCUA通道管理

提供了OPCUA通道的增删改查、根据设备ID更新OPCUA设备独有的信息、根据设备ID查询OPCUA通道列表等功能。

5.3.1创建OPCUA通道

功能描述:新建一个通道

POST  /api/v1/device/5/channel

Body:

Name Type Description Required
name String 通道名称 Yes
userName String 用户名 No
password String 密码 No
gatewayid int 网关设备ID Yes
secureMode int 安全模式:0-None,1-Sign,2-SignAndEncrypt No
securePolicy int 安全策略:0-None,1-Basic128Rsa15,2-Basic256 No
timeout int 超时时间 Yes
endpoint String 通道地址,必须以opc.tcp://开头 Yes

Body example:

{
  "name": "name01",
  "userName": "test",
  "password": "testt01",
  "gatewayid": 100201,
  "secureMode": 0,
  "securePolicy": 0,
  "timeout": 100,
  "endpoint": "opc.tcp://localhost"
}

cURL example:

curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/device/5/channel?accessKeyId={accessKeyId}&signatureNonce=719&signature={signature}' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
              "name": "name01",
              "userName": "test",
              "password": "testt01",
              "gatewayid": 100201,
              "secureMode": 0,
              "securePolicy": 0,
              "timeout": 100,
              "endpoint": "opc.tcp://localhost"
            }'

Response data:

Name Type Description
name String 通道名称
userName String 用户名
password String 密码
gatewayid int 网关设备ID
secureMode int 安全模式:0-None,1-Sign,2-SignAndEncrypt
securePolicy int 安全策略:0-None,1-Basic128Rsa15,2-Basic256
timeout int 超时时间
endpoint String 通道地址,必须以opc.tcp://开头
id int 通道ID

Response example:

{
  "success": true,
  "code": 0,
  "msg": null,
  "data": {
            "name": "name01",
            "userName": "test",
            "password": "testt01",
            "gatewayid": 100201,
            "secureMode": 0,
            "securePolicy": 0,                       
            "timeout": 100,
            "endpoint": "opc.tcp://localhost",
            "id": 139
          }
}

5.3.2查询OPCUA设备独有的信息

功能描述:根据ID查询OPCUA设备独有的信息

GET  /api/v1/device/protocol/5/{id}

Path:

Name Type Description Required
id int 通道ID Yes

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/device/protocol/5/110?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}' \
--header 'platform: 3' \
--header 'projectId: {projectId}'

Response data:

Name Type Description
id int 通道ID
channelId int 网关通道配置ID
collectTime int 设备数据采集间隔
opcuaPath string 节点路径

Response example:

{
  "success": true,
  "code": 0,
  "msg": null,
  "data": {
    "id": 10000332,
    "channelId": 110,
    "collectTime": 1000,
    "opcuaPath": "34134131341341324"
  }
}

5.3.3查询OPCUA通道列表

功能描述:根据设备ID查询OPCUA通道列表

GET  /api/v1/device/5/channel/device/{deviceId}

Path:

Name Type Description Required
deviceId int 设备ID Yes

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/device/5/channel/device/10000801?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}' \
--header 'platform: 3' \
--header 'projectId: {projectId}'

Response data:

Name Type Description
data struct[] OPC UA通道列表

Response data data的子对象结构体:

Name Type Description
id int 通道ID
gatewayId int 网关ID
name string 通道名称
endpoint string 通道地址
userName string 用户名
password string 密码
secureMode int 安全模式:0-None,1-Sign,2-SignAndEncrypt
securePolicy int 安全策略:0-None,1-Basic128Rsa15,2-Basic256
timeout int 超时时间

Response example:

{
  "success": true,
  "code": 0,
  "msg": null,
  "data": [
    {
      "id": 107,
      "gatewayid": 10000147,
      "name": "string11",
      "endpoint": "string",
      "userName": "string",
      "password": "strin22g",
      "secureMode": 0,
      "securePolicy": 0,
      "timeout": 0
    },
    {
      "id": 108,
      "gatewayid": 10000147,
      "name": "22222",
      "endpoint": "string",
      "userName": "string",
      "password": "",
      "secureMode": 0,
      "securePolicy": 0,
      "timeout": 0
    }
  ]
}

5.3.4OPCUA通道配置

功能描述:根据设备ID更新OPCUA设备独有的信息

PUT  /api/v1/device/protocol/5

Body:

Name Type Description Required
id int 设备ID Yes
channelId int 通道ID No
collectTime int 数据采集间隔 No
opcuaPath String 节点路径 No

Body example:

{
  "id": 101,
  "collectTime": 12
}

cURL example:

curl --location --request PATCH '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/device/protocol/5?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
              "id": 101,
              "collectTime": 12
            }'

Response example:

{
  "success": true,
  "code": 0,
  "msg": null,
  "data": null
}

5.3.5更新OPCUA通道

功能描述:根据通道ID更新OPCUA通道

PUT  /api/v1/device/5/channel

Body:

Name Type Description Required
id int 通道ID Yes
name String 通道名称 No
userName String 用户名 No
password String 密码 No
gatewayid int 网关设备ID No
secureMode int 安全模式:0-None,1-Sign,2-SignAndEncrypt No
securePolicy int 安全策略:0-None,1-Basic128Rsa15,2-Basic256 No
timeout int 超时时间 No
endpoint String 通道地址 No

Body example:

{
  "id": 101,
  "collectTime": 12
}

cURL example:

curl --location --request PATCH '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/device/5/channel?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
              "id": 101,
              "collectTime": 12
            }'

Response example:

{
  "success": true,
  "code": 0,
  "msg": null,
  "data": null
}

5.3.6删除OPCUA通道

功能描述:根据通道ID删除OPCUA通道信息

DELETE  /api/v1/device/5/channel/{id}

Path:

Name Type Description Required
id int 通道ID Yes

cURL example:

curl --location --request DELETE '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/device/5/channel/110?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}' \
--header 'platform: 3' \
--header 'projectId: {projectId}'

Response example:

{
  "success": true,
  "code": 0,
  "msg": null,
  "data": null
}

results matching ""

    No results matching ""